#   Copyright (c)  2021 FromVB2Python
#   FromVB2Python is licensed under Mulan PSL v2.
#   You can use this software according to the terms and conditions of the Mulan PSL v2. 
#   You may obtain a copy of Mulan PSL v2 at:
#            http://license.coscl.org.cn/MulanPSL2 
#   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
#   See the Mulan PSL v2 for more details.
#   048-学考-三角形统计-201902-14温州选考模拟 shell版本
num = 0
a = list(input('请输入一组数据，并用,隔开：').split(','))
k=list(filter(None,a)) #取掉空元素
a_list = [] #整理用，去掉多余的'\n'和 ''
c_list = [] #用来放能够形成三角形的
#注意末尾加逗号，不然会被过滤掉
for i in range(len(k)):
    try:
        if float(k[i]) or float(k[i])==0: 
            a_list.append(k[i])
    except:
        pass
#切割分块
b_list = [a_list[i:i+3] for i in range(0, len(a_list),3)]
for i in range(len(b_list)):
    if len(b_list[i])==3:#长度为3的进行判断是否构成三角形
        #print('长度是3的',b_list[i],i)
        a = float(b_list[i][0]) #边a
        b = float(b_list[i][1]) #边b
        c = float(b_list[i][2]) #边c
        if a+b>c and a+c>b and b+c>a: #任意两边之和大于第三边
            num = num+1
            c_list.append(b_list[i])
print('一共包含了{}个三角形'.format(num))
print(c_list)
    
 
